package lagou.cn.test

object HowManyBear {
  def getBears(x1:Int,x2:Int,bears:Int): Unit ={
    if (x1<3 && x2 < 5){
      println(bears)
    }else {
      var bottle: Int = x1 / 3
      var gaizi: Int = x2 / 5
      val y1 = x1 / 3 + x2 / 5 + x1 % 3
      val y2 = x1 / 3 + x2 / 5 + x2 % 5
      getBears(y1, y2, bears + bottle + gaizi)
    }
  }
  def main(args: Array[String]): Unit = {
    getBears(50,50,0)
  }
}
